﻿using MyTodo.Common.Models;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyTodo.Shared.Dtos;

namespace MyTodo.ViewModels;

public class IndexViewModel : BindableBase
{
    public IndexViewModel()
    {
        CreateTaskBars();
        CreateTestData();
    }


    public ObservableCollection<TaskBar> TaskBarsList { set; get; } = new ObservableCollection<TaskBar>();
    public ObservableCollection<ToDoDto> ToDoDtos { set; get; } = new ObservableCollection<ToDoDto>();
    public ObservableCollection<MemoDto> MemoDtos { set; get; } = new ObservableCollection<MemoDto>();

    private void CreateTaskBars()
    {
        TaskBarsList.Add(new TaskBar() { Icon = "ClockFast", Title = "汇总", Content = "10", Color = "#0CA0FF", Target = "" });
        TaskBarsList.Add(new TaskBar() { Icon = "ClockCheckOutline", Title = "已完成", Content = "9", Color = "#1ECA3A", Target = "" });
        TaskBarsList.Add(new TaskBar() { Icon = "ChartLineVariant", Title = "完成率比例", Content = "90%", Color = "#02C6DC", Target = "" });
        TaskBarsList.Add(new TaskBar() { Icon = "PlaylistStar", Title = "备忘录", Content = "19", Color = "#FFA000", Target = "" });
    }
    private void CreateTestData()
    {
        for (int i = 0; i < 10; i++)
        {
            ToDoDtos.Add(new ToDoDto() { Title = "待办" + i, Content = "正在处理..." });
            MemoDtos.Add(new MemoDto() { Title = "备忘" + i, Content = "密码..." });
        }
    }

}
